using NUnit.Framework;

namespace Agile.Common.Tests
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	[TestFixture]
	public class ActionResultTests
	{
		#region SuccessfulAction Tests

		/// <summary>
		/// Verifies the functionality of successful action
		///		- Create a successful action
		///		- Check WasSuccessful is true
		///		- Check FailureReason is null
		/// </summary>
		[Test]
		public void SuccessfulActionTests()
		{
			// Create a successful action
			ActionResult result = ActionResult.Success;
			// Check WasSuccessful is true
			Assert.IsTrue(result.WasSuccessful, "Check WasSuccessful is true");
			// Check FailureReason is null
			Assert.IsNull(result.FailureReason, "Check FailureReason is null");
		}

		#endregion

		
		#region FailedAction Tests

		/// <summary>
		/// Verifies the functionality of Failed action
		///		- Create a Failed action
		///		- Check WasFailed is true
		///		- Check FailureReason is null
		/// </summary>
		[Test]
		public void FailedActionTests()
		{
			// Create a Failed action
			ActionResult result = ActionResult.Failed("Widget is required");
			// Check WasSuccessful is false
			Assert.IsFalse(result.WasSuccessful, "Check WasSuccessful is false");
			// Check FailureReason is 'Widget is required'
			Assert.AreEqual("Widget is required", result.FailureReason, "Check FailureReason is 'Widget is required'");
		}

		#endregion
	}
}
